// 状态列表 1待处理/2待调价/3待审核/4已处理
const STATE_OPTIONS = [
  {
    label: '待处理',
    value: '1'
  },
  {
    label: '调价中',
    value: '2'
  },
  {
    label: '待审核',
    value: '3'
  },
  {
    label: '已处理',
    value: '4'
  },
]
export const PRICE_STATE_OPTIONS = [
  {
    label: '是',
    value: 1
  },
  {
    label: '否',
    value: 2
  },
]
// 初始化查询条件
export const initFormItemList = (departmentData, areaData) => {
  return [
    {
      prop: 'state',
      label: '处理状态',
      type: 'select',
      options: STATE_OPTIONS
    },
    {
      prop: 'overdueState',
      label: '是否超期',
      type: 'select',
      options: PRICE_STATE_OPTIONS
    },
    // startDate endDate
    {
      prop: 'statisticsDate',
      label: '统计日期',
      type: 'datePicker',
      valueFormat: 'yyyy-MM-dd'
    },
    {
      prop: 'supplyNoOrName',
      label: '供应商',
      type: 'input'
    },
    {
      prop: 'manageAreaUuid',
      label: '业务区域',
      type: 'select',
      filterable: true,
      clearable: true,
      options: areaData,
    },
    {
      prop: 'authDepartmentNo',
      label: '归属中心',
      type: 'selectFilter',
      filterable: true,
      clearable: true,
      allOptions: departmentData || [],
      options: [],
    },
    {
      prop: 'handlerName',
      label: '处理人',
      type: 'input'
    },
    {
      prop: 'recordNo',
      label: '单据号',
      type: 'input'
    },
    {
      prop: 'adjustPriceState',
      label: '是否需调整进价',
      type: 'select',
      options: PRICE_STATE_OPTIONS
    },
  ]
}
// 列表表头
export const getTableColumns = (parent) => {
  return [
    {
      title: '单据号',
      key: 'recordNo',
    },
    {
      title: '创建日期',
      key: 'createdTime',
    },
    {
      title: 'SKU数',
      key: 'skuCount',
    },
    {
      title: '处理状态',
      key: 'stateStr',
    },
    {
      title: '是否超期',
      key: 'overdueStateStr',
    },
    {
      title: '价格管理周期',
      key: 'priceManagementCycle',
    },
    {
      title: '供应商代码',
      key: 'supplyUuid',
    },
    {
      title: '供应商名称',
      key: 'supplyName',
    },
    {
      title: '是否金属',
      key: 'supplyMetalStr',
    },
    {
      title: '供应商管理区域',
      key: 'supplyManagementAreaName'
    },
    {
      title: '业务联系人',
      key: 'supplyContactPerson'
    },
    {
      title: '业务区域',
      key: 'manageAreaName'
    },
    {
      title: '归属部门',
      key: 'authDepartmentName'
    },
    {
      title: '业务对接人',
      key: 'supplyBusinessContactPerson'
    },
    {
      title: '供应商类别',
      key: 'supplyTypeStr'
    },
    {
      title: '去年进货额',
      key: 'supplyLastYearAmount'
    },
    {
      title: '本年进货额',
      key: 'supplyYearAmount'
    },
    {
      title: '是否需调整进价',
      key: 'adjustPriceStateStr',
      render: (h, { row }) => {
        return <span>{row.state == 1 ? '' : row.adjustPriceStateStr}</span>
      }
    },
    {
      title: '处理人',
      key: 'handlerName',
      /* render: (h, { row }) => {
        return <span>{row.state == 1 ? '' : row.operName}</span>
      } */
    },
    {
      title: '处理时间',
      key: 'handleTime',
    },
    {
      title: '审核人',
      key: 'auditorName',
    },
    {
      title: '审核时间',
      key: 'auditTime',
    },
    {
      title: '处理备注说明',
      key: 'processRemark',
      render: (h, { row }) => {
        return <span>{row.state == 1 ? '' : row.processRemark}</span>
      }
    },
    {
      title: '调价单据号',
      key: 'associatedRecordNo',
      width: 120,
    },
  ]
}

// 供货明细查询条件
export const DETAIL_FORM_ITEMS = [
  {
    prop: 'state',
    label: '处理状态',
    type: 'select',
    options: STATE_OPTIONS
  },
  {
    prop: 'overdueState',
    label: '是否超期',
    type: 'select',
    options: PRICE_STATE_OPTIONS
  },
  // startDate endDate
  {
    prop: 'statisticsDate',
    label: '统计日期',
    type: 'datePicker',
    valueFormat: 'yyyy-MM-dd'
  },
]
// 供货信息表头
export const DETAIL_TABLE_COLUMNS = [
  {
    title: 'SKU编码',
    key: 'skuNo',
  },
  {
    title: '商品名称',
    key: 'productName',
  },
  {
    title: '规格',
    key: 'spec'
  },
  {
    title: '计量单位',
    key: 'unitName'
  },
  {
    title: '处理状态',
    key: 'stateStr',
  },
  {
    title: '是否超期',
    key: 'overdueStateStr',
  },
  {
    title: '统计日期',
    key: 'createdTime',
  },
  {
    title: '上次调价日期',
    key: 'adjustPriceTime',
  },
  {
    title: '不审核调价日期',
    key: 'unAdjustPriceTime',
  },
  {
    title: '未调价天数',
    key: 'unAdjustPriceDays',
  },
  {
    title: '价格管理周期',
    key: 'priceManagementCycle',
  },
  {
    title: '供应商代码',
    key: 'supplyUuid',
  },
  {
    title: '供应商名称',
    key: 'supplyName',
  },
  {
    title: '是否敏感',
    key: 'isPriceSensitiveStr',
  },
  {
    title: '供应商管理区域',
    key: 'supplyManagementAreaName',
  },
  {
    title: '业务区域',
    key: 'manageAreaName',
  },
  {
    title: '归属部门',
    key: 'authDepartmentName',
  },
]
